home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / fpu881 / src6.zoo / pml.h < prev    next >
C/C++ Source or Header  |  1991-09-24  |  5KB  |  159 lines

  1. /************************************************************************
  2.  *                                    *
  3.  *                N O T I C E                *
  4.  *                                    *
  5.  *            Copyright Abandoned, 1987, Fred Fish        *
  6.  *                                    *
  7.  *    This previously copyrighted work has been placed into the    *
  8.  *    public domain by the author (Fred Fish) and may be freely used    *
  9.  *    for any purpose, private or commercial.  I would appreciate    *
  10.  *    it, as a courtesy, if this notice is left in all copies and    *
  11.  *    derivative works.  Thank you, and enjoy...            *
  12.  *                                    *
  13.  *    The author makes no warranty of any kind with respect to this    *
  14.  *    product and explicitly disclaims any implied warranties of    *
  15.  *    merchantability or fitness for any particular purpose.        *
  16.  *                                    *
  17.  ************************************************************************
  18.  */
  19.  
  20.  
  21. /*
  22.  *    This file gets included with all of the floating point math
  23.  *    library routines when they are compiled.  Note that
  24.  *    this is the proper place to put machine dependencies
  25.  *    whenever possible.
  26.  *
  27.  *    It should be pointed out that for simplicity's sake, the
  28.  *    environment parameters are defined as floating point constants,
  29.  *    rather than octal or hexadecimal initializations of allocated
  30.  *    storage areas.  This means that the range of allowed numbers
  31.  *    may not exactly match the hardware's capabilities.  For example,
  32.  *    if the maximum positive double precision floating point number
  33.  *    is EXACTLY 1.11...E100 and the constant "MAXDOUBLE is
  34.  *    defined to be 1.11E100 then the numbers between 1.11E100 and
  35.  *    1.11...E100 are considered to be undefined.  For most
  36.  *    applications, this will cause no problems.
  37.  *
  38.  *    An alternate method is to allocate a global static "double" variable,
  39.  *    say "maxdouble", and use a union declaration and initialization
  40.  *    to initialize it with the proper bits for the EXACT maximum value.
  41.  *    This was not done because the only compilers available to the
  42.  *    author did not fully support union initialization features.
  43.  *
  44.  */
  45.  
  46. #ifndef NO_DBUG
  47. #    include <dbug.h>
  48. #else
  49. #    define DBUG_ENTER(a1)
  50. #    define DBUG_RETURN(a1) return(a1)
  51. #    define DBUG_VOID_RETURN return
  52. #    define DBUG_EXECUTE(keyword,a1)
  53. #    define DBUG_2(keyword,format)
  54. #    define DBUG_3(keyword,format,a1)
  55. #    define DBUG_4(keyword,format,a1,a2)
  56. #    define DBUG_5(keyword,format,a1,a2,a3)
  57. #    define DBUG_PUSH(a1)
  58. #    define DBUG_POP()
  59. #    define DBUG_PROCESS(a1)
  60. #    define DBUG_FILE (stderr)
  61. #    define ENTER(a1)
  62. #    define LEAVE()
  63. #    define DEBUG3(keyword,format,a1)
  64. #    define DEBUG4(keyword,format,a1,a2)
  65. #    define DEBUGPUSH(a)
  66. #    define DEBUGWHO(w)
  67. #endif
  68.  
  69. #include <errno.h>
  70. extern int errno;
  71.  
  72. #ifndef atarist
  73. #ifdef ATARI_ST
  74. #include <std.h>
  75. #endif
  76. #endif
  77. /*
  78.  *    MAXDOUBLE    =>    Maximum double precision number
  79.  *    MINDOUBLE    =>    Minimum double precision number
  80.  *    DMAXEXP        =>    Maximum exponent of a double
  81.  *    DMINEXP        =>    Minimum exponent of a double
  82.  */
  83.  
  84. #define MAXDOUBLE    1.7e+308
  85. #define MINDOUBLE    2.225e-308
  86. #define DMAXEXP        1023
  87. #define DMINEXP        (-1022)
  88.  
  89. #define LOG2_MAXDOUBLE 1024
  90. #define LOG2_MINDOUBLE (-1023)
  91. #define LOGE_MAXDOUBLE  7.09782712893383970e+02
  92. #define LOGE_MINDOUBLE  -7.09089565712824080e+02
  93.  
  94. /*
  95.  *    The following are hacks which should be fixed when I understand all
  96.  *    the issues a little better.   |tanh(TANH_MAXARG)| = 1.0
  97.  */
  98. #define TANH_MAXARG 16
  99. #define SQRT_MAXDOUBLE 1.304380e19
  100.  
  101. #define PI        3.14159265358979323846
  102. #define TWOPI         6.28318530717958620
  103. #define HALFPI        1.57079632679489660
  104. #define FOURTHPI    0.785398163397448280
  105. #define SIXTHPI        0.523598775598298820
  106.  
  107. #define LOG2E        1.4426950408889634074    /* Log to base 2 of e */
  108. #define LOG10E        0.4342944819032518276
  109. #define SQRT2        1.41421356237309504880
  110. #define SQRT3        1.7320508075688772935
  111. #define LN2        0.69314718055994530942
  112. #define LNSQRT2        0.3465735902799726547
  113.  
  114.  
  115. /*
  116.  *    MC68000 HARDWARE DEPENDENCIES
  117.  *
  118.  *        cc -DIEEE    =>    uses IEEE floating point format
  119.  *
  120.  */
  121.  
  122. #ifdef IEEE
  123. #define X6_UNDERFLOWS (4.209340e-52)    /* X**6 almost underflows */
  124. #define X16_UNDERFLOWS (5.421010e-20)    /* X**16 almost underflows    */
  125. #endif
  126.  
  127. #ifdef TRUE
  128. #undef TRUE
  129. #endif
  130.  
  131. #ifdef FALSE
  132. #undef FALSE
  133. #endif
  134.  
  135. #define TRUE 1
  136. #define FALSE 0
  137. #define VOID void
  138.  
  139. #if ((defined(__STDC__)) && (!defined(__NO_PROTO__)))
  140. double modf(double, double *);
  141. double ldexp(double, int);
  142.  
  143. /* mjr: i don't undestand this...
  144.  #ifdef __MSHORT__
  145.  double frexp(double, short *);
  146.  #else
  147.  double frexp(double, int *);
  148.  #endif
  149. */
  150.  double frexp(double, int *);
  151.  
  152. #else
  153.  
  154. extern double modf(/* double, double * */);
  155. extern double ldexp(/* double, int  */);
  156. extern double frexp(/* double, int * */);
  157.  
  158. #endif /* __STDC__ */
  159.